package com.owc.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2020/3/3 17:28
 * @Version 1.0.0
 * @Description <>
 **/
@Getter
public enum FileTypeEnum {
    IMAGE(10,"图片","image/"),
    FILE(20,"文件","file/"),
    APK(30,"执行包","release/");

    FileTypeEnum(Integer type, String desc, String folder) {
        this.type = type;
        this.desc = desc;
        this.folder = folder;
    }

    private Integer type;

    private String desc;

    private String folder;

    public static Optional<FileTypeEnum> match(Integer type) {
        return Arrays.stream(FileTypeEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
